<template>
  <div>

    <van-form v-show="xs">
      <p>
        <van-field label="描述信息" v-model="disms"/>
      </p>
      <p>
        <input type="radio" :value="2" v-model="dx">通过
        <input type="radio" :value="1" v-model="dx">不通过
        <van-button @click="tijiao">提交</van-button>
      </p>
    </van-form>

    <table border="1" cellspacing="0">
      <tr>
        <td>请求人</td>
        <td>操作</td>
      </tr>
      <tr v-for="i in shenpi" :key="i.id">
        <td>{{i.name}}</td>
        <td>
          <button @click="sp(i.id)">审批</button>
        </td>
      </tr>
    </table>
  </div>

</template>

<script>
import maxios from "@/http/axios";

export default {
name: "com_sp",
  data(){
  return{
    shenpi:[],
    disms:'',
    dx:'',
    xs:false,
    id : ''
  }
  },
  methods:{
  get_sp(){
    maxios('http://127.0.0.1:8000/users/post_jilu/').then(res=>{
      this.shenpi = res.data.list
    })
    },
    sp(id){
      this.id = id
      this.xs = true
    },
    tijiao(){
    maxios('http://127.0.0.1:8000/users/niuma/','post',{'disms':this.disms,"dx":this.dx,'id':this.id}).then(res=>{
      if(res.data.code==200){
        alert('ok')
      }else {
        alert('no')
      }
    })
    }
  },
  mounted() {
  this.get_sp()
  }
}
</script>

<style scoped>

</style>
